home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / Ghostscript / src / gspcolor.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-01  |  4.4 KB  |  124 lines

  1. /* Copyright (C) 1997, 1998, 1999 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of AFPL Ghostscript.
  4.   
  5.   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
  6.   distributor accepts any responsibility for the consequences of using it, or
  7.   for whether it serves any particular purpose or works at all, unless he or
  8.   she says so in writing.  Refer to the Aladdin Free Public License (the
  9.   "License") for full details.
  10.   
  11.   Every copy of AFPL Ghostscript must include a copy of the License, normally
  12.   in a plain ASCII text file named PUBLIC.  The License grants you the right
  13.   to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14.   conditions described in the License.  Among other things, the License
  15.   requires that the copyright notice and this notice be preserved on all
  16.   copies.
  17. */
  18.  
  19. /*$Id: gspcolor.h,v 1.2 2000/09/19 19:00:31 lpd Exp $ */
  20. /* Client interface to Pattern color */
  21.  
  22. #ifndef gspcolor_INCLUDED
  23. #  define gspcolor_INCLUDED
  24.  
  25. #include "gsccolor.h"
  26. #include "gsrefct.h"
  27. #include "gsuid.h"
  28.  
  29. /* ---------------- Types and structures ---------------- */
  30.  
  31. /*
  32.  * We originally defined the gs_client_pattern structure before we
  33.  * realized that we would have to accommodate multiple PatternTypes.
  34.  * In version 5.68, we bit the bullet and made an incompatible change
  35.  * to this structure so that multiple PatternTypes could be supported.
  36.  * In order to make this work:
  37.  *
  38.  *    Clients creating instances of any Pattern template structure
  39.  *    (gs_patternN_template_t) must call gs_patternN_init to
  40.  *    initialize all the members, before filling in any of the
  41.  *    members themselves.
  42.  *
  43.  * This is a non-backward-compatible requirement relative to previous
  44.  * versions, but it was unavoidable.
  45.  */
  46.  
  47. /*
  48.  * Define the abstract pattern template (called "prototype pattern" in Red
  49.  * Book).
  50.  */
  51.  
  52. #ifndef gs_pattern_type_DEFINED
  53. #  define gs_pattern_type_DEFINED
  54. typedef struct gs_pattern_type_s gs_pattern_type_t;
  55. #endif
  56.  
  57. #define gs_pattern_template_common\
  58.   const gs_pattern_type_t *type;\
  59.   int PatternType;        /* copied from the type structure */\
  60.   gs_uid uid;\
  61.   void *client_data        /* additional data for rendering */
  62.  
  63. typedef struct gs_pattern_template_s {
  64.     gs_pattern_template_common;
  65. } gs_pattern_template_t;
  66.  
  67. /* The descriptor is public for subclassing. */
  68. extern_st(st_pattern_template);
  69. #define public_st_pattern_template() /* in gspcolor.c */\
  70.   gs_public_st_ptrs2(st_pattern_template, gs_pattern_template_t,\
  71.     "gs_pattern_template_t", pattern_template_enum_ptrs,\
  72.     pattern_template_reloc_ptrs, uid.xvalues, client_data)
  73. #define st_pattern_template_max_ptrs 2
  74.  
  75. /* Definition of Pattern instances. */
  76. #ifndef gs_pattern_instance_DEFINED
  77. #  define gs_pattern_instance_DEFINED
  78. typedef struct gs_pattern_instance_s gs_pattern_instance_t;
  79. #endif
  80.  
  81. #define gs_pattern_instance_common\
  82.     rc_header rc;\
  83.     /* Following are set by makepattern */\
  84.     const gs_pattern_type_t *type;  /* from template */\
  85.     gs_state *saved
  86. struct gs_pattern_instance_s {
  87.     gs_pattern_instance_common;
  88. };
  89.  
  90. /* The following is public for subclassing. */
  91. extern_st(st_pattern_instance);
  92. #define public_st_pattern_instance() /* in gspcolor.c */\
  93.   gs_public_st_ptrs1(st_pattern_instance, gs_pattern_instance_t,\
  94.     "gs_pattern_instance_t", pattern_instance_enum_ptrs,\
  95.     pattern_instance_reloc_ptrs, saved)
  96. #define st_pattern_instance_max_ptrs 1
  97.  
  98. /* ---------------- Procedures ---------------- */
  99.  
  100. /* Set a Pattern color or a Pattern color space. */
  101. int gs_setpattern(P2(gs_state *, const gs_client_color *));
  102. int gs_setpatternspace(P1(gs_state *));
  103.  
  104. /*
  105.  * Construct a Pattern color of any PatternType.
  106.  * The gs_memory_t argument for gs_make_pattern may be NULL, meaning use the
  107.  * same allocator as for the gs_state argument.  Note that gs_make_pattern
  108.  * uses rc_alloc_struct_1 to allocate pattern instances.
  109.  */
  110. int gs_make_pattern(P5(gs_client_color *, const gs_pattern_template_t *,
  111.                const gs_matrix *, gs_state *, gs_memory_t *));
  112. const gs_pattern_template_t *gs_get_pattern(P1(const gs_client_color *));
  113.  
  114. /*
  115.  * Adjust the reference count of a pattern. This is intended to support
  116.  * applications (such as PCL) which maintain client colors outside of the
  117.  * graphic state. Since the pattern instance structure is opaque to these
  118.  * applications, they need some way to release or retain the instances as
  119.  * needed.
  120.  */
  121. void gs_pattern_reference(P2(gs_client_color * pcc, int delta));
  122.  
  123. #endif /* gspcolor_INCLUDED */
  124.